package com.up.upzl.biz.util;

import java.util.Map;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.extern.slf4j.Slf4j;

/**
 * JSON工具类
 * 
 * @author geeks
 *
 */
@Slf4j
public class JsonHelper {

	private static final ObjectMapper objectMapper = new ObjectMapper();

	/**
	 * 将Map转为JSON串
	 * 
	 * @param params
	 * @return
	 */
	public static String stringify(Map<Object, Object> params) {
		String paramsString = null;
		try {
			paramsString = objectMapper.writeValueAsString(params);
		} catch (JsonProcessingException e) {
			log.info("WriteValueAsString exception", e);
		}
		return paramsString;
	}
}
